﻿package com.tudou.home.newskin.containers
{
    import com.tudou.skin.*;
    import flash.display.*;

    public class LoadingTudou extends Sprite
    {
        private var smile:DisplayObject;
        private var background:DisplayObject;
        private var fontBmp:DisplayObject;
        private var pHeight:Number = 0;
        private var pWidth:Number = 0;

        public function LoadingTudou()
        {
            super.visible = false;
            return;
        }// end function

        override public function set visible(param1:Boolean) : void
        {
            if (param1)
            {
                if (!super.visible)
                {
                    background = new LoadingBackgroundMC();
                    smile = new TudouSmileMC();
                    fontBmp = new Bitmap(new TudouTextBMP(147, 29));
                    addChild(background);
                    addChild(smile);
                    addChild(fontBmp);
                }
            }
            else if (super.visible)
            {
                removeChild(background);
                removeChild(smile);
                removeChild(fontBmp);
                background = null;
                smile = null;
                fontBmp = null;
            }
            super.visible = param1;
            if (param1)
            {
                this.width = pWidth;
                this.height = pHeight;
            }
            return;
        }// end function

        override public function set height(param1:Number) : void
        {
            if (visible)
            {
                background.height = param1;
                smile.y = int(param1 / 2);
                fontBmp.y = smile.y - 15;
            }
            pHeight = param1;
            return;
        }// end function

        override public function set width(param1:Number) : void
        {
            if (visible)
            {
                background.width = param1;
                smile.x = int(param1 / 2 - 110);
                fontBmp.x = smile.x + 35;
            }
            pWidth = param1;
            return;
        }// end function

    }
}
